/**
 * 信用卡服务层
 * by:fanzhongxing
 */
const creditDAO = require('../DAO/creditDAO.js');
const dbCloud = require('../dbCloud.js');

const { getOpenid } = dbCloud;

/**
 * 获取信用卡列表
 */
const getCreditList = async () => {
  var openid = getOpenid();
  return creditDAO.getCreditList(openid);
};

/**
 * 添加信用卡
 */
const addCredit = async (params) => {
  var openid = getOpenid();
  params._openid = openid;
  return creditDAO.addCredit(params);
}

/**
 * 通过id获取信息
 */
const getCreditInfo = async (params) => {
  return creditDAO.getCreditInfo(params);
}

/**
 * 删除信用卡
 */
const delCredit = async (params) => {
  return creditDAO.delCredit(params);
}

/**
 * 修改信用卡信息
 */
const editCredit = async () => {
  return creditDAO.editCredit();
}

module.exports = {
  getCreditList,
  getCreditInfo,
  addCredit,
  delCredit,
  editCredit
};